#!/bin/bash -e

function info() {
echo Usage: `basename $0` 'bam bed'
exit 1
}

while getopts  ":p:f:i:g" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
        i) bed=$OPTARG;;
        g) gvcf=true;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))

if [ $# -lt 1 ]; then info; fi

. $var

if test -n "$gvcf"; then emit_gvcf="--emitRefConfidence GVCF"; fi

bam=$1
bed=$2

# HaplotypeCaller # its use is not recommended for somatic (cancer) variant discovery. For that purpose, use MuTect2 instead.

echo; echo HaplotypeCaller
$java_run/gatk38 \
    -R $ref_genome \
    -T HaplotypeCaller $emit_gvcf \
    -I $bam \
    -L $bed \
    -o $out_prefix.g.vcf \
    --useNewAFCalculator \
    -stand_call_conf 0 \
    --gcpHMM 5 \
    --kmerSize 10 \
    --kmerSize 12 \
    --kmerSize 13 \
    --kmerSize 15 \
    --kmerSize 19 \
    --kmerSize 25 \
    --kmerSize 35 \
    --minPruning 1 \
    --minDanglingBranchLength 3 \
    --allowNonUniqueKmersInRef

    # -bamout $out_prefix.hc.bam \

    # -graph $out_prefix.graph \


. $cmd_done
